import lodash from 'lodash'
import BusinessError from '@/core/framework/error/BusinessError'
import { translate } from '@/core/i18n/service/i18nService'

class AssertUtils {
	isNil = (value: any, i18nKey: string, defaultMessage: string): void => {
		if (lodash.isNil(value)) {
			throw new BusinessError(-1, translate(i18nKey, defaultMessage))
		}
	}

	isEmpty = (value: any, i18nKey: string, defaultMessage: string): void => {
		if (lodash.isEmpty(value)) {
			throw new BusinessError(-1, translate(i18nKey, defaultMessage))
		}
	}
}

export default new AssertUtils()
